package sy.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

public class CodeUtil {
	/**
	 * 据当前时间生成维修单号/投诉单号
	 * @Title: getCode
	 * @Description: TODO
	 * @param: @return     
	 * @return: String     
	 * @author:  xieyuanqiu
	 * @date: 2017年8月22日 下午3:37:16
	 * @throws
	 */
	public String getCode(){
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
		Date date = new Date();
		String code = simpleDateFormat.format(date);
		return code;
	}
	
	public static int getRandomNo(){
		int radomInt = new Random().nextInt(999999);
		String fileName = String.valueOf(radomInt);
		do{
			radomInt = new Random().nextInt(999999);
		}while(fileName.length()<6);
		return radomInt;
	}
	public static void main(String[] arg){
		int radomInt = new Random().nextInt(9);
		System.out.println(radomInt);
	}
}
